---@class TBS.FollowUIEffect:TBS.EffectBase
local FollowUIEffect = TBS.CreateClass("FollowUIEffect","EffectBase")
function FollowUIEffect:OnCreate()
    TBS.EffectBase.OnCreate(self)
    self.isFollow = true
    self.followGroupId = 0
    self.followGroupIndex = 0
end
function FollowUIEffect:OnDestroy()
    TBS.EffectBase.OnDestroy(self)
    CloseEvent(TBS.Config.Event.GetUIPos,self.GetUIPos,self)
end
function FollowUIEffect:SetFollow(groupId,groupIndex)
    self.followGroupId = groupId
    self.followGroupIndex = groupIndex
end
function FollowUIEffect:OnLoadDone()
    TBS.EffectBase.OnLoadDone(self)
    self.isFollow = true
    ListenEvent(TBS.Config.Event.GetUIPos,self.GetUIPos,self)
end
function FollowUIEffect:Update(dt)
    TBS.EffectBase.Update(self,dt)
    if self.isFollow then
        FireEvent(TBS.Config.Event.NeedUIPos,self.followGroupId,self.followGroupIndex)
    end
end
function FollowUIEffect:GetUIPos(groupId,groupIndex,x,y)
    if self.followGroupId ~= groupId or self.followGroupIndex ~= groupIndex then
        return
    end
    x,y = TBS.Battle.ScreenToScenePoint(x,y)
    self.pos:Set(x,y)
    self:SetObjPos(self.pos)
end
